/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

/**
 *  妫�祴绫�鐢ㄤ簬鎻愪緵妫�祴鐨勫姛鑳�濡傛灉绫绘槸鍚﹀瓨鍦� *  鏁扮粍涓嬫爣鏈夋棤婧㈠嚭绛� * @author 姊佸墠姝�QQ1587790525
 */
public class check {
    /**
     * 妫�煡瀵硅薄鏄惁涓虹┖
     * @param o 瀵硅薄
     * @return  true false
     */
    public static boolean checkObjectEixst(Object o){
        if(o!=null){
            System.out.println("class is :"+o.toString());
            return true;
        }else{
            System.out.println("class is no exist");
            return false;
        }
    }
    
    public static boolean checkString(String o){
    	if(o==null||o.equals("")){
    		return false;
    	}
    		return true;
    }
    
    public static boolean checkObjectEqu(Object o1,Object o2){
        if(o1==o2){
            System.out.println("two class is equal");
            return true;
        }else{
            System.out.println("two class is inequality");
            return false;
        }
    }
    
    public static boolean isNumeric(String str){
    	if(str==null||str.equals(""))
    		return false;
    	try{
    		        new Float(str);
    		      return true;
    		      }catch(Exception e2){
    		    		for (int i = str.length();--i>=0;){   
    		    	    	   if (!Character.isDigit(str.charAt(i))){ 
    		    	    		  return false;
    		    	    	   } 
    		    	    	} 
    		          }
    
    	return true; 
    	} 
        /**
         * sql语句仿注入
         * @param str
         * @return
         */
    	public static boolean sql_inj(String str)
    	{
    	    String inj_str = "'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|;|or|-|+|,";//这里的东西还可以自己添加
    	String[] inj_stra=inj_str.split("\\|");
    	    for (int i=0 ; i < inj_stra.length ; i++ )
    	    {
    	        if (str.indexOf(inj_stra[i])>=0)
    	        {
    	            return true;
    	        }
    	    }
    	    return false;
    	}
    	

}
